-
Notifications
You must be signed in to change notification settings - Fork 1
chore: Request status tracking #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/neptune_scale/__init__.py
Outdated
if not self._sync_process.is_alive(): | ||
if verbose: | ||
logger.warning("Sync process is not running") | ||
return # No need to wait if the sync process is not running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If sync process is dead, shouldn't we signal an error? It's not situation normal, and we have no means of restarting it (and we shouldn't)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will (separate PR that should rework the signal handling)
return None | ||
|
||
items = [] | ||
for i in range(min(size, min(max_size, size))): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
min(size, max_size)
, or did you mean something different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh, good catch. I'm blaming Copilot as I was certain that it was range(min(size, max_size))
before some refactors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
a89c60f
to
e9659f3
Compare
3d68f02
to
7e77204
Compare
src/neptune_scale/__init__.py
Outdated
) | ||
|
||
|
||
def should_print_message(last_message_printed: Optional[float]) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kgodlewski I've done the refactor requested by you in previous PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this user-facing? If so, what's the purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not 😉
src/neptune_scale/__init__.py
Outdated
) | ||
|
||
|
||
def should_print_message(last_message_printed: Optional[float]) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this user-facing? If so, what's the purpose?
{h1} | ||
----NeptuneRunDuplicate-------------------------------------------------------- | ||
{end} | ||
Identical run already exists. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is raised when you create a run with an existing ID but without resume=True
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
This will trigger error above:
with Run(run_id=run_id, family=run_id):
...
with Run(run_id=run_id, family=run_id):
...
This works:
with Run(run_id=run_id, family=run_id):
...
with Run(run_id=run_id, family=run_id, resume=True):
...
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
src/neptune_scale/__init__.py
Outdated
else: | ||
if last_message_printed is None or time.time() - last_message_printed > STOP_MESSAGE_FREQUENCY: | ||
if verbose and should_print_message(last_message_printed): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny detail, but in the future we could do:
def print_message(msg: str, last_print_timestamp: Optional[float], verbose: bool) -> float
, the func would return the current time if it printed the message. So we could just do:
last_message_printed = print_message(f"some message", last_message_printed, verbose)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
items.append(item) | ||
return items | ||
|
||
def commit(self, n: int) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not just now, but we need a different name here, don't know just yet how different ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually making it even more common name (introduced commit
to all of the threads); let's address that in next PR to get a better context
return MockedApiClient() | ||
return HostedApiClient(api_token=api_token) | ||
|
||
|
||
class SyncThread(Daemon, WithResources): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about renaming this to SenderThread
, or ApiSenderThread
, or something that is less generic than Sync
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SenderThread
works for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -283,7 +400,11 @@ def work(self) -> None: | |||
try: | |||
run_operation = RunOperation() | |||
run_operation.ParseFromString(data) | |||
self.submit(operation=run_operation) | |||
request_id = self.submit(operation=run_operation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we ever return None
from self.submit
-> Reponse.parsed
? I mean, if the backend fails to return a proper RequestId
, I think we should raise an error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's a address that in next PR
No description provided.